/*
    http://bhepple.freeshell.org

    Copyright (C) 2010 Bob Hepple <bhepple@freeshell.org>

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program; see the file COPYING.  If not, write to
    the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.

*/

/**
 * \file tbm.h - miscellaneous
 */

/**
 * run a command through execve() and get the result through a pipe.
 * Also, this function waits for the child to finish so don't put it
 * in the background.
 *
 * \param command [IN] the command to run in the form of **argv, ready
 * for execve(). Note that no shell features are available - eg no
 * expansion of filenames is done eg *.c; no | or > redirection etc.
 * Easily built up with tba_push_str()
 *
 * \return a string of the output from the command.
 */
tbs tbm_backtick(const tba command);

/**
 * run a command through bash - probably only useful if you need to
 * capture stdout. Also, this function waits for the child to finish
 * so don't put it in the background.
 *
 * \param command [IN] the command to run in the form of **argv, ready
 * for execve()
 *
 * \param status [OUT] a pointer to an int to hold the exit status of
 * the system() call. If NULL then nothing is returned.
 *
 * \return a string of the output from the command.
 */
tbs tbm_system(const tbs command, int * status);
